package meadproperty.views;

import meadproperty.service.Constant;
import meadproperty.util.PropertyFileUtil;

import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;

public class ViewLabelProvider extends LabelProvider implements
		ITableLabelProvider {
	public String getColumnText(Object element, int columnIndex) {

		if (columnIndex == 0) {
			return element.toString();
		}
		String path = Constant.ACTIVE_FILE_PATH
				+ Constant.ACTIVE_CONFIG.getFileSet().get(columnIndex)
				+ Constant.EXTENSION_PROP_FILE;
		System.out.println(path + "  #PATH  ###" + columnIndex);
		String value = PropertyFileUtil.readValue(path, element.toString());

		return ":" + value;
	}

	public Image getColumnImage(Object obj, int index) {
		return getImage(obj);
	}
}